package ar.com.vates.threads2;

public class Contenedor {

	private int variable;

	public Contenedor() {
		this.variable = (int) Math.random();
	}

	public synchronized void borrarVariable() throws InterruptedException {
		if (variable == 0)
			wait();
		variable = 0;
		System.out.println("Borro: " + variable);
		notify();
	}

	public synchronized void escribirVariable(int valor)
			throws InterruptedException {
		if (variable != 0)
			wait();
		variable = valor;
		System.out.println("Escribio: " + variable);
		notify();
	}
}